UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'wfaSos7Miy1oL5iAeBe0UdVCEiXDYDmvL1eLI/zjCDE=' 
WHERE 
  key_id = '09ecd8896d9d643643d91141f12dfac8edd7408a25be9b55e918529ab0c37431' 
  AND (
    token = 'wfaSos7Miy1oL5iAeBe0UdVCEiXDYDmvL1eLI/zjCDE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00042