UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'rTdvLbmG+IzE3kEB5ZWVixSiboUhJz1aYZfmmPeaH90=' 
WHERE 
  key_id = 'da3b80ca9f8ad676bef15635e579a2490803a80c570c154af97f8cbaa836e97f' 
  AND (
    token = 'rTdvLbmG+IzE3kEB5ZWVixSiboUhJz1aYZfmmPeaH90=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00048