UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'DCDeHAESAsG7oklk/2iW+Li7GiDTf9AcyKiK20ujg2Q=' 
WHERE 
  key_id = 'dfc4c802931991c2b8e7d4518a2261947c5001a53b633287dbcdbbc2e118976f' 
  AND (
    token = 'DCDeHAESAsG7oklk/2iW+Li7GiDTf9AcyKiK20ujg2Q=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026