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

Query time 0.00051