UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'EAs7SoXbDVoWdwXTg7RScNGuoW4jjBzPlibudUlnDyA=' 
WHERE 
  key_id = '83412deeeb9e186004ccf04f704dc3ce092e99a4e6a078392058b4d4a0e08b24' 
  AND (
    token = 'EAs7SoXbDVoWdwXTg7RScNGuoW4jjBzPlibudUlnDyA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00045