UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'SVM1yTS28lY0EjdV+dYs3agoNrn/qSOozGm74VVsez8=' 
WHERE 
  key_id = 'e590a8328df3d3661ebd4585012077fb364672a3305dd12b992f0d14485f0612' 
  AND (
    token = 'SVM1yTS28lY0EjdV+dYs3agoNrn/qSOozGm74VVsez8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00025