UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '3xsqxJjGRiatS25Iky0FaR7m4ITnct/2rhSrtRrY9Ls=' 
WHERE 
  key_id = '66a8c7a9bd207d02a651444b05696621ba4e7893b81f03d05320ac17a5b5410e' 
  AND (
    token = '3xsqxJjGRiatS25Iky0FaR7m4ITnct/2rhSrtRrY9Ls=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00045