UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Np1hT/jHHrrbykbGHVR+elbrjRZAsiq1x/9pkr4GYUE=' 
WHERE 
  key_id = 'e5f31ae1194d24de16e6beffd7c3149dba93d314ab772f43a70de3c809ce3d48' 
  AND (
    token = 'Np1hT/jHHrrbykbGHVR+elbrjRZAsiq1x/9pkr4GYUE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00024