UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'aljLKI6oBOveUaOKBxT1MrEEsfgSUyR7nXylAqpARbE=' 
WHERE 
  key_id = 'ad40ddd4952980a67df2b2b6245df7398fa0129ae49e6113304fda9d8e48011e' 
  AND (
    token = 'aljLKI6oBOveUaOKBxT1MrEEsfgSUyR7nXylAqpARbE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037