UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '2JNcZmPZQfORvwkho27WwUcqhuIxVAy0AGNDrk+4b0k=' 
WHERE 
  key_id = '9ddfdcf75bf58d24fabcdf706aef8a5ce699de5952658699196e13fd3b455cbc' 
  AND (
    token = '2JNcZmPZQfORvwkho27WwUcqhuIxVAy0AGNDrk+4b0k=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028