UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'nnDqxyF5OULMs6b7al9AEgTg2aBV3n6tNQBWBvhLcAg=' 
WHERE 
  key_id = '476c8e0ea89fa57bd978bdc866621f6ee5e3436d264b53d372c288f9e6920fa5' 
  AND (
    token = 'nnDqxyF5OULMs6b7al9AEgTg2aBV3n6tNQBWBvhLcAg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00044