UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'FbOUM2w+yJpOLSyV0nI5WSE8YdnkKlO1GXcshCuH3Ac=' 
WHERE 
  key_id = '8d9670a7ca4e232964576c05f4dd43bed9aeb553b5a9d09cd2964da2a7d44776' 
  AND (
    token = 'FbOUM2w+yJpOLSyV0nI5WSE8YdnkKlO1GXcshCuH3Ac=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026