UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '7wV0BuGuHHqc4xlJdJqF1DVv9ktXg4L+879CzDzrUt0=' 
WHERE 
  key_id = '203f08ca771d853b3668204180483bc8c1058d78e898c4a1be3fbc035d532996' 
  AND (
    token = '7wV0BuGuHHqc4xlJdJqF1DVv9ktXg4L+879CzDzrUt0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036