UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'MfHJT+1xVoVSSFdpcewtMrzf0Ea2tprklszoTVYAeVM=' 
WHERE 
  key_id = '68b541a02629bf3821f5e6f95593633ceb4dec93b161f90605527ce9b3bf4e47' 
  AND (
    token = 'MfHJT+1xVoVSSFdpcewtMrzf0Ea2tprklszoTVYAeVM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038