UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'SlL267vEndIdfNqvCRG2997SiYYxzaQVahaFuV/1gco=' 
WHERE 
  key_id = 'd38aa2d8c600f8edcf27ad707d7379ae682f42aa990238cc419971ca1dc0bda5' 
  AND (
    token = 'SlL267vEndIdfNqvCRG2997SiYYxzaQVahaFuV/1gco=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028