UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'iNn92IccZOsM308dA9BGHcmXJ2iTc9pyl5bE7K16Ids=' 
WHERE 
  key_id = 'ae1296ddad782003d00e09c6b56afb76a89ffab43bd45c84896526b998ebe388' 
  AND (
    token = 'iNn92IccZOsM308dA9BGHcmXJ2iTc9pyl5bE7K16Ids=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030