UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Yd1ye8siO4ddgpmblM8Qu0zkFX6J0oJ2JwOVcd8l0FI=' 
WHERE 
  key_id = 'c21876655111037d168838821b0fa7f70d098853610b567c381ac2363fa4fb8c' 
  AND (
    token = 'Yd1ye8siO4ddgpmblM8Qu0zkFX6J0oJ2JwOVcd8l0FI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031