UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '6DzVTZQwYFtxAtQI+JFr0Rsa6wEzKDI777r+rJWuS3k=' 
WHERE 
  key_id = '66e4b46afa28641c3c76f30daf1f5e3389067820aa40c8c3640084b3815ab68f' 
  AND (
    token = '6DzVTZQwYFtxAtQI+JFr0Rsa6wEzKDI777r+rJWuS3k=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00053