UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'g6zDN0Di+CWQvFlp8I2oeP1WKryGR4adN+bfP+ZN0EI=' 
WHERE 
  key_id = 'a8a86905993fd1f858b41f3ceff7ca033630fb7de8d2a5b610e95dfeeaebdb04' 
  AND (
    token = 'g6zDN0Di+CWQvFlp8I2oeP1WKryGR4adN+bfP+ZN0EI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00022