UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'mhiBGIHWexwp5sdiFStPa9BCLWj189CbZYVDuynBCsE=' 
WHERE 
  key_id = '56806d41751e860453ef38895b34dedcb4c76bc41dc21b20372ebe766f092307' 
  AND (
    token = 'mhiBGIHWexwp5sdiFStPa9BCLWj189CbZYVDuynBCsE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038