UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'gupawBmBOgjjWnq7ik/0wTdIGRarHTcCQt5jYGG34UI=' 
WHERE 
  key_id = 'de3673a6b2a638491324668c03120ab4e3e7a260c545a12dda1a37b06a6865f4' 
  AND (
    token = 'gupawBmBOgjjWnq7ik/0wTdIGRarHTcCQt5jYGG34UI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00048