UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '7QICNdZkBFMcjk3KzKQaRviubarv+2J7mMU3NNZ2y2Q=' 
WHERE 
  key_id = 'b7586b286411423f1e8d5d5f74818f6d3fb7dae55468dd9643f71cfa44224d9f' 
  AND (
    token = '7QICNdZkBFMcjk3KzKQaRviubarv+2J7mMU3NNZ2y2Q=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00041