UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '4Wlah8RprNrQUnaBBELfRiaqpXUwUr67PyEPyRbvEiU=' 
WHERE 
  key_id = '6832e4f4a74ac86fb00f269af09734bb0a44d0abaf6c1dc458afd82864b92731' 
  AND (
    token = '4Wlah8RprNrQUnaBBELfRiaqpXUwUr67PyEPyRbvEiU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037