UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'IzKYpu3JF2C2m58yeNoypU9OjH6XrtuZPKdfrpOT0a0=' 
WHERE 
  key_id = '6dad00904b5ded63dc69a77c548aad419c4f149e48d6f52b2446796ebc44f725' 
  AND (
    token = 'IzKYpu3JF2C2m58yeNoypU9OjH6XrtuZPKdfrpOT0a0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00024