UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'qjH8shKZvnY1IAMjNf1h0Mj8IrCQN6btkAqX/OllcCc=' 
WHERE 
  key_id = '4933cf1ae12f15c1b59e2cbe5bff535740c14130f880480b4141423802bdb73e' 
  AND (
    token = 'qjH8shKZvnY1IAMjNf1h0Mj8IrCQN6btkAqX/OllcCc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00057