UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'fKvs+knRA3jmQBAtvlb39YjnnXQQs3RGeCZ1YZ/vTi0=' 
WHERE 
  key_id = 'f56fde9a381b7c3348748e0d5fd3fe8d64c88fe92cfd3acbd9ff5bea70312909' 
  AND (
    token = 'fKvs+knRA3jmQBAtvlb39YjnnXQQs3RGeCZ1YZ/vTi0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031