UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'YHEpqil2ipjVom4qe0TS3BXTfwDm5iRCSms4tNbobaY=' 
WHERE 
  key_id = '91bbcd0c59151c620ee2099e8563dec92dab12f328626724f205e7f58b436041' 
  AND (
    token = 'YHEpqil2ipjVom4qe0TS3BXTfwDm5iRCSms4tNbobaY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036