UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'pwb6YRGb6Ra+gNa7GEeszpzi06lsJQRBCIQpiaiikUo=' 
WHERE 
  key_id = 'da22cd03f7c69394c163e0688a70de818c6b14b7a71560d26c7cc77b96a8e457' 
  AND (
    token = 'pwb6YRGb6Ra+gNa7GEeszpzi06lsJQRBCIQpiaiikUo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032