UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'tDNxiCaE/4m3r9ANOJ3LlMvY2GvPawsPRnqT6eLPpoo=' 
WHERE 
  key_id = 'a05dd4343ab138360a52533211f65442740eb1ab6b6e7a1dbafc4baf7919309d' 
  AND (
    token = 'tDNxiCaE/4m3r9ANOJ3LlMvY2GvPawsPRnqT6eLPpoo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026