UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'B+1EkfXTACjj7nj4q0Ej4jYQhJEdvQzqpTmzlIg88zk=' 
WHERE 
  key_id = '67b462652fc979157830c7b61746f077bc42335ea26c7bd186dc627e6c0423f4' 
  AND (
    token = 'B+1EkfXTACjj7nj4q0Ej4jYQhJEdvQzqpTmzlIg88zk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032