UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'tlFXJ6vYg4dQv/P7aYqSAlUGkZ1XfS+83II3fp+Mcjc=' 
WHERE 
  key_id = '8e0c430735ea28481321a7b4ad072b5fdf22c478d3ae7624994979db548431d4' 
  AND (
    token = 'tlFXJ6vYg4dQv/P7aYqSAlUGkZ1XfS+83II3fp+Mcjc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035