UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'zTBTktk+MZ6maKwMRX6XEwsH5gNNkrYo1kwW53yOGYk=' 
WHERE 
  key_id = '022c503c0165c0dff4868e3053795b7d9edc5d883261898b25f209e12ae4a84e' 
  AND (
    token = 'zTBTktk+MZ6maKwMRX6XEwsH5gNNkrYo1kwW53yOGYk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00053