UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'f37aKockdkD5MmEYuIAM8E4EJkYGIT38yX2tyVde/v0=' 
WHERE 
  key_id = 'cb495407beeb194952e49ca58982336db3b035df9dacfefce801cac052fb0127' 
  AND (
    token = 'f37aKockdkD5MmEYuIAM8E4EJkYGIT38yX2tyVde/v0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038