UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'J3lsTrd+I7SBeCztCmQVDL5Qtzzb6o3mYkQZTsGtLCU=' 
WHERE 
  key_id = '549b9f52a74a27a6bb547f74b89557cc8a44573d5f252445195caca87ca1c861' 
  AND (
    token = 'J3lsTrd+I7SBeCztCmQVDL5Qtzzb6o3mYkQZTsGtLCU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036