UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'b/dphMqOJhQzy6jI6cZdTj6LGOBXwVgxrQzRj6jyO4I=' 
WHERE 
  key_id = 'd543941a42986e2e616e99bbecd39fa39106a0c674d6bd251354b68db9a399db' 
  AND (
    token = 'b/dphMqOJhQzy6jI6cZdTj6LGOBXwVgxrQzRj6jyO4I=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037