UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'c8ihvp0uSNcHsSQaKLtQ2lMQxFjeJmRu81IjSUZ2y7A=' 
WHERE 
  key_id = '1021709662ae4e88cb3b1f354cc6a74679662c19b8fe3ec9af6146ace6959cb6' 
  AND (
    token = 'c8ihvp0uSNcHsSQaKLtQ2lMQxFjeJmRu81IjSUZ2y7A=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00017