UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'EMlcZCa3CcWJFvM2LXsskQLDoDmAR3RwumOY5io5pSA=' 
WHERE 
  key_id = '2b146392980f8c19d7dd6f9b21230236fbb4bf47a6650b1e38e87d68e07cc1c3' 
  AND (
    token = 'EMlcZCa3CcWJFvM2LXsskQLDoDmAR3RwumOY5io5pSA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00021